﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Export_Report
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div style="height:300px;">
    <div id="cssmenu" style="margin-left:100px;width:250px; float:left;">
        <ul>
            <li ><span  class="head cell"style=" margin-left:5px;" >Report</span></li>
            <li><a id="a1" class="sel" href="#"><span>1. Report By Shift</span></a></li>
            <li><a id="a2" href="#"><span>2. Report By Roll</span></a></li>
            <li><a id="a3" href="#"><span>3. Report Summery</span></a></li>
        </ul>
    </div>
    <div style="margin-left:20px; width:500px; float:left">
        <table id="tbl1" style="text-align:left;" width="100%">
            <tr id="trheader" class="top ">
                <td colspan="2" style="border: 1px solid #000000">
                    Report By Shift</td>
            </tr>
            <tr id="trBias" class="rowb tr">
                <td class="style2">
                    Bias no.</td>
                <td class="cell" id="code"><%: TireBias.Models.SessionBag.Current.biasno %>
                 </td>
            </tr>
            <tr id="trDate" class="rowb tr">
                <td class="style2">
                    DATE</td>
                <td class="cell">
                    <input id="dates" type="text" /></td>
            </tr>
            
            <tr id="trShift" class="rowb tr">
                <td class="style2">
                    Shift</td>
                <td class="cell">
                    <input id="shift"  type="text" /></td>
            </tr>
                <tr id="trBarcode" class="rowb tr hide">
                <td class="style2">
                   Barcode</td>
                <td class="cell">
                    <input id="barcode" style="width: 350px" type="password"   /></td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style1">
                    <button id="exp" class="btn" style=" width:150px; color:Black;">
                        Report
                    </button>
                    <button id="cancel" class="btn" style=" width:150px; color:Black;">
                        Cancel
                    </button>
                </td>
            </tr>
        </table>


    </div>
    </div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="FeaturedContent" runat="server">

</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="TableContent" runat="server">

 <style type="text/css">
 #cssmenu {
  background:#333;
  list-style: none;
  margin: 0;
  padding: 0!important;
  width: 1em;
  color:#fff;
  font-size:smaller
}
#cssmenu ul
{   margin: 0;
    padding: 0!important;
}
#cssmenu a.sel {
  background: #999;
  color: #000;
}

#cssmenu li {

  margin: 0;
  padding: 0;
  list-style: none;
}
#cssmenu a {
   background: #2580a2 url("../Images/hover.gif") left center no-repeat;
  color: #fff;
  border-bottom: 1px solid #393939;
  line-height:30px;
  display: block;
  margin: 0;
  padding: 10px 14px;
  text-decoration: none;
  font-weight: bolder;
}
#cssmenu a:hover {
 background: #fff;
 color: #000;
 padding-bottom: 10px;
}

.top
{
    font-weight:bolder;
    background-color:#AAD4FF;
    line-height:40px;
    text-align:center;
}
.cell
{
       border-right:1px solid #000000!important;
}
.head
{
    border-left:1px solid #000000!important;
       border-right:0px!important;
    line-height:45px!important;
}
#code,#dates,#shift,#barcode
{
    height:25px;
    width:350px;
    padding-top:5px;
    padding-bottom:5px;
}

.style1
{
    height: 47px;
}

.style2
{
    width: 71px;
    border:1px solid #000;
    font-weight:bold;
    text-align:center;
}
.style3
{
    height: 47px;
    width: 71px;
}
.hide
{
    display:none;
}

 </style>

</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="ScriptsSection" runat="server">

    <% if (false)
      { %>
   <script src="../../Scripts/jquery-1.7.1.js" type="text/javascript"></script>
   <% }; %>

   <script type="text/javascript">
       $(function () {
           $("a").click(function () {
               $("#cssmenu a.sel").removeClass("sel");
               $(this).addClass("sel");
               $(".tr").addClass("hide");
               var menu = $(this).attr("id");
               $("#trheader").find("td").text($(this).text());
               if (menu == "a1") {
                   $("#trDate,#trBias,#trShift").removeClass("hide");
               }
               if (menu == "a2") {
                   $("#trBarcode,#trDate,#trBias,#trShift").removeClass("hide");
               }
           });

           $("#exp").button({
               icons: { primary: 'ui-icon-circle-zoomout' }, text: true
           }).click(function () {
               var menu = $("#cssmenu a.sel").attr("id");
               if (menu == "a1") {
                   menu1();
               }
               if (menu == "a2") {
                   $("#trBarcode").removeClass("hide");
                   menu2();
               }
           });

           function menu1() {
               var code = "";
               code = $("#code").text();
               if ($("#dates").val() == "") {
                   alert("ระบุวันที่");
                   $("#dates").focus();
                   return;
               }

               if ($("#shift").val() == "") {
                   alert("ระบุกะที่ทำงาน");
                   $("#shift").focus();
                   return;
               }

               var url = '<%=Url.Action("Report","DemoReport") %>' + "?code=" + code + "&dateExport=" + $("#dates").val() + "&shift=" + $("#shift").val();
               window.open(url)

           }

           function menu2() {
             var  code = $("#code").text();
             var   bcode = $("#barcode").val();

               if (bcode == "") {
                   alert("ระบุข้อมูล");
                   $("#barcode").focus();
                   return;
               }
               if ($("#dates").val() == "") {
                   alert("ระบุวันที่");
                   $("#dates").focus();
                   return;
               }

               if ($("#shift").val() == "") {
                   alert("ระบุกะที่ทำงาน");
                   $("#shift").focus();
                   return;
               }

               var url = '<%=Url.Action("Report","DemoReport") %>' + "?code=" + code + "&dateExport=" + $("#dates").val() + "&shift=" + $("#shift").val();

               url += "&topcode=" + bcode.split("+")[0] + "&toplot=" + bcode.split("+")[1] + "&rep=a2";

               window.open(url)

           }

           $('#dates').dateEntry({ useMouseWheel: false, dateFormat: 'dmy/' });
           $("#cancel").button({
               text: true
           }).click(function () {

               var nextURL = '<%= Url.Action("Index","BiasTail") %>';
               window.location = nextURL;
           });
       });
    </script>
</asp:Content>
